<template>
  <div style="background-color: #f7f8fa">
    <van-cell-group>
      <van-cell @click="toUserInfo" is-link>
        <template #title>
          <div style="display: flex;">
            <van-image
                round
                fit="cover"
                width="55px"
                height="55px"
                :src="user.avatarUrl"
            />
            <div style="margin-left: 20px">
              <h3>{{ user.userName }}</h3>
              <p>账号：{{ user.userAccount }}</p>
            </div>
          </div>
        </template>
      </van-cell>
    </van-cell-group>
    <van-cell-group style="margin-top: 10px;">
      <van-cell title="我的队伍" @click="toMyTeam" is-link />
    </van-cell-group>
  </div>
</template>

<script setup lang="ts">

import myAxios from "../plugins/myAxios";
import {useRouter} from "vue-router";
import {ref, onMounted} from "vue";

const user = ref({});
onMounted(async () => {
  const response = await myAxios.get('/user-manage/currentUser') as any;
  if (response) {
    user.value = response.data;
  }
});
const router = useRouter();
const toUserInfo = () => {
  router.push('/user-info');
};
const toMyTeam = () => {
  router.push('/my-team');
};
</script>

<style scoped>

</style>
